﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace RentIt06
{
    [ServiceContract(Namespace = "RentIt06", SessionMode = SessionMode.Required)]
    public interface IAdminSession {
        /// <summary>
        /// Login; Starting a new session.
        /// </summary>
        /// <param name="email">The email to login with</param>
        /// <param name="password">The password</param>
        [OperationContract(IsInitiating = true, IsTerminating = false)]
        Account Login(string email, string password);

        // Account CRUD - C (see ICreateAccount)
        /// <summary>
        /// Read the details of an account
        /// </summary>
        /// <param name="email">The email of the account to read</param>
        /// <returns>And account object with the described account</returns>
        [OperationContract(IsInitiating = false, IsTerminating = false)]
        Account ReadAccountEmail(string email);
        
        // Account CRUD - C (see ICreateAccount)
        /// <summary>
        /// Read the details of an account
        /// </summary>
        /// <param name="id">The id of the account to read</param>
        /// <returns>And account object with the described account</returns>
        [OperationContract(IsInitiating = false, IsTerminating = false)]
        Account ReadAccountId(int id);

        /// <summary>
        /// Reads all accounts.
        /// </summary>
        /// <returns>A list of all accounts currently in the system.</returns>
        [OperationContract(IsInitiating = false, IsTerminating = false)]
        List<Account> ReadAllAccounts();


        // Admin user tools
        /// <summary>
        /// Deletes the account with the given id.
        /// This method requires admin privileges
        /// </summary>
        /// <param name="id">The id of the account to delete</param>
        [OperationContract(IsInitiating = false, IsTerminating = false)]
        void DeleteAccount(int id);

        /// <summary>
        /// Change the access level of an account
        /// This method requires admin privileges
        /// </summary>
        /// <param name="id">The id of the account</param> 
        /// <param name="accessLevel">The new access level that the account will have. </param>
        [OperationContract(IsInitiating = false, IsTerminating = false)]
        void ChangeAccountAccessLevel(int id, PermissionGroup accessLevel);

        /// <summary>
        /// Logout; Ending the session.
        /// </summary>
        [OperationContract(IsInitiating = false, IsTerminating = true)]
        void Logout();
    }
}
